{% extends 'base.html' %}
{% block title %} - Search Project{% endblock %}
{% block onload %}
onload="document.getElementById('kw_input').focus();"
{% endblock %}
{% block content %}
<script>
	function search(){
		var parm = $("#kw_input").val();
		location.href='/project/search/?key=' + parm ;
	}
</script>
<div id="content" style="position:absolute; top:20px; left:0px; background-color: #1A1A1A; layer-background-color: #1A1A1A; border: 1px none #000000;">
<table width="610">
	<tr>
		<td colspan="2"><p><span style="font-size:14px;color:#CCC">Search project</span></p></td>
	</tr>		
	<tr><td colspan="2">
		<input id="kw_input" type="text" name="keyword" 
			onchange="search();"
			value="{{keyword}}" size="40" />      
		<input type="button" value="Search" onclick="search();" />
        </td>
	</tr>			
		
     <tr><td colspan="2"><br></br>
        Project list | {% if projects.has_previous %} 
		<a href="?key={{keyword}}&page={{ projects.previous_page_number }}" title="Previous page"><<<</a> {% endif %}
		Page {{ projects.number }} of {{ projects.paginator.num_pages }}.
		{% if projects.has_next %}
		<a href="?key={{keyword}}&page={{ projects.next_page_number }}" title="Next page">>>></a>
		{% endif %}<br></br>
     
        
      </tr></td>
</table>

<table width="610">
    
	{% for project in projects.object_list %}
  <tr>
		<td><a href="/project/{{project.id}}/" title="Open project">{{project.name}}</a>
      </td>
		<td>
		{{project.description|safe|slice:"100" }}
		</td>
        <td width="40">
        {% if user.username == 'kth' or user.id == project.creator.id %}
				<a href="/project/{{project.id}}/edit/" title="Edit project">
				<img src="/site_media/img/approve.gif"/>
			</a>
        <a href="/project/{{project.id}}/delete/" title="Delete project" 
        	onclick="return confirm('Delete this project?');">
				<img src="/site_media/img/trash.gif"/>
			</a>
		{% endif %}
        </td>
	</tr>
	
    {% endfor %}
</table>


</div>

{% endblock %}

